﻿using System;
using System.Collections.Generic;
using System.Text;
using G3.AI;

namespace G3.Controller
{
    public static class Statistics
    {
        private static Dictionary<IDriver, List<double>> storedData = new Dictionary<IDriver, List<double>>();

        public static void Reset()
        {
            storedData.Clear();
        }

        public static List<double> LapTimes(IDriver owner)
        {
            return storedData[owner];
        }

        public static void RequireSlot(IDriver owner)
        {
            if (!storedData.ContainsKey(owner)) storedData.Add(owner, new List<double>());
        }

        public static void SendLapTime(IDriver sender, double lapTime)
        {
            if (!storedData.ContainsKey(sender)) throw new Exception("the driver hasn't required a slot");
            storedData[sender].Add(lapTime);
        }
    }
}
